﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using CoreClasses;

namespace ProjectCollaborationServerWCF
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IServiceContract" in both code and config file together.
    [ServiceContract]
    public interface IServiceContract
    {

        [OperationContract]
        Layout[] GetLayouts();

        [OperationContract]
        Layout GetLayout(string layoutNam);

        [OperationContract]
        ProjectArea[] GetProjectAreas(string layoutName);

        [OperationContract]
        ProjectArea GetProjectArea(string layoutName, string projectArea);

        [OperationContract]
        bool AddProjectArea(string layoutName, string projectArea, Rectangle area, Byte[] detailedLayout);

        [OperationContract]
        bool AddLayout(Layout layout);

        [OperationContract]
        void DeleteLayout(string layoutName);

        [OperationContract]
        void DeleteProject(string projectName, string layoutName);

        [OperationContract]
        void DeleteGeneralStation(string stationName);

        [OperationContract]
        bool AddGeneralStation(Station station);

        [OperationContract]
        Station[] GetGeneralStations();


    }

    [DataContract]
    [Serializable]
    public class Layout
    {
        private string _layoutName;
        private SerializableFrameworkElement.Data _layoutElement;
        private string _pointCloudReference;
        private double _height;
        private double _width;


        [DataMember]
        public string LayoutName
        {
            get { return _layoutName; }
            set { _layoutName = value; }
        }

        [DataMember]
        public SerializableFrameworkElement.Data LayoutElement
        {
            get { return _layoutElement; }
            set { _layoutElement = value; }
        }

        [DataMember]
        public string PointCloudReference
        {
            get { return _pointCloudReference; }
            set { _pointCloudReference = value; }


        }

        [DataMember]
        public double Width
        {
            get { return _width; }
            set { _width = value; }
        }

        [DataMember]
        public double Height
        {
            get { return _height; }
            set { _height = value; }
        }
    }

    [DataContract]
    [Serializable]
    public class ProjectArea
    {
        private string _projectAreaName;
        private Rectangle _projectAreaDef;
        private string _layoutName;
        private byte[] _detaildLayout;

        [DataMember]
        public string ProjectAreaName
        {
            get { return _projectAreaName; }
            set { _projectAreaName = value; }
        }

        [DataMember]
        public Rectangle ProjectAreaDef
        {
            get { return _projectAreaDef; }
            set { _projectAreaDef = value; }
        }

        [DataMember]
        public string LayoutName
        {
            get { return _layoutName; }
            set { _layoutName = value; }
        }

        [DataMember]
        public byte[] DetailedLayout
        {
            get { return _detaildLayout; }
            set { _detaildLayout = value; }
        }
    }

    [DataContract]
    [Serializable]
    public class Station
    {
        private string _stationName;
        private double _stationSizeX;
        private double _stationSizeY;
        private string _color;
        private byte[] _control;
        private string _controlType;
        private string _syncId;

        /// <summary>
        /// </summary>
        [DataMember]
        public string SyncId
        {
            get { return _syncId; }
            set { _syncId = value; }
        }

        [DataMember]
        public string Name
        {
            get { return _stationName; }
            set { _stationName = value; }
        }

        [DataMember]
        public double SizeX
        {
            get { return _stationSizeX; }
            set { _stationSizeX = value; }
        }

        [DataMember]
        public double SizeY
        {
            get { return _stationSizeY; }
            set { _stationSizeY = value; }
        }

        [DataMember]
        public string Color
        {
            get { return _color; }
            set { _color = value; }
        }

        [DataMember]
        public byte[] Control
        {
            get { return _control; }
            set { _control = value; }
        }

        [DataMember]
        public string ControlType
        {
            get { return _controlType; }
            set { _controlType = value; }
        }
    }


    // Use a data contract as illustrated in the sample below to add composite types to service operations.


}
